package com.yami.shop.mystery.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.mystery.common.model.MysteryBoxExtension;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 盲盒商品扩展表 数据层
 * @author wxf
 * @date 2023/4/10 10:33
 */
public interface MysteryBoxExtensionMapper extends BaseMapper<MysteryBoxExtension> {

    /**
     *  通过盲盒
     *
     * @param boxId
     * @return
     */
    List<MysteryBoxExtension> findExtensionByBoxId(@Param("boxId") Long boxId);

    /**
     * 回退盲盒商品库存
     *
     * @param extension
     * @return
     */
    int rollbackStocks(@Param("extension") MysteryBoxExtension extension);

    /**
     * 扣除盲盒商品库存
     *
     * @param extension
     * @return
     */
    int expendStocks(@Param("extension") MysteryBoxExtension extension);
}
